﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace _20170206_Game_1_1
{
    class OldGame
    {
        /*
        private int fieldHeight;
        private int fieldWidth;
        private Drawer drawer;
        private GameNode node;
        private char borderSymbol;
        private char nodeSymbol;

        public OldGame()
        {
            FieldHeight = 20;
            FieldWidth = 60;
            borderSymbol = '*';
            nodeSymbol = '$';
            Init();
        }

        public OldGame(int fieldHeight, int fieldWidth)
        {
            FieldHeight = fieldHeight;
            FieldWidth = fieldWidth;
            borderSymbol = '*';
            nodeSymbol = '$';
            Init();
        }

        public OldGame(int fieldHeight, int fieldWidth, char borderSymbol, char nodeSymbol)
        {
            FieldHeight = fieldHeight;
            FieldWidth = fieldWidth;
            this.borderSymbol = borderSymbol;
            this.nodeSymbol = nodeSymbol;
            Init();
        }

        private int FieldHeight
        {
            get
            {
                return fieldHeight;
            }
            set
            {
                if (value < 3)
                    fieldHeight = 3;
                else if (value > 20)
                    fieldHeight = 20;
                else
                    fieldHeight = value;
            }
        }

        private int FieldWidth
        {
            get
            {
                return fieldWidth;
            }
            set
            {
                if (value < 3)
                    fieldWidth = 3;
                else if (value > 60)
                    fieldWidth = 60;
                else
                    fieldWidth = value;
            }
        }

        private void Init()
        {
            node = new GameNode(fieldWidth / 2, fieldHeight / 2);
            drawer = new Drawer(nodeSymbol);
            ShowBorder(borderSymbol);
            Run();
        }

        private void Run()
        {
            Random r = new Random();
            while (true)
            {
                //0 - left
                //1 - up
                //2 - right
                //3 - down
                int choise = r.Next(4);
                drawer.ClearGameNode(node);
                switch (choise)
                {
                    case 0:
                        if (node.X > 1)
                            node.MoveLeft();
                        break;
                    case 1:
                        if (node.Y > 1)
                            node.MoveUp();
                        break;
                    case 2:
                        if (node.X < FieldWidth - 2)
                          node.MoveRight();
                        break;
                    case 3:
                        if (node.Y < FieldHeight - 2)
                            node.MoveDown();
                        break;
                }
            drawer.DrawGameNode(node);

        }
    }

        private void ShowBorder(char symbol)
        {
            for (int i = 0; i < fieldWidth; i++)
                Console.Write(symbol);
            Console.WriteLine();
            for (int i = 0; i < fieldHeight - 2; i++)
            {
                Console.Write(symbol);
                for (int j = 0; j < fieldWidth - 2; j++)
                    Console.Write(' ');
                Console.WriteLine(symbol);
            }
            for (int i = 0; i < fieldWidth; i++)
                Console.Write(symbol);
            Console.WriteLine();
        }
        */

    }
}
